import { ImgStoreData } from "./../../../storage/.config/store.type";
import { Pipe, PipeTransform, Inject } from "@angular/core";
import { urlApi } from "src/app/service/service.module";
import config from "./../../../storage/.config/store.config";

@Pipe({
  name: "imgHover"
})
export class ImgHoverPipe implements PipeTransform {
  constructor(@Inject(urlApi) private apiUrl: string) {}

  transform(item: ImgStoreData["data"][0]) {
    if (!item.config.storage) {
      return `${this.apiUrl}/${item.name}/${config.album.defaultHover}`;
    } else {
      return `${item.config.storage}/${item.name}/${config.album.defaultHover}`;
    }
  }
}
